package biolabs.core

/**
 * Interface for interactions performed on
 * a parent bio-object and (some of) its children.
 *
 * @tparam T type of the parent bio-object that initiates the interaction.
 * @tparam P type of partial result (for progress notifications). May be Unit.
 * @tparam R type of the final interaction result. May be Unit.
 * @tparam D type of children's delegates.
 * @tparam U type of child bio-objects that participate in the interaction.
 *
 * @author Tomas Mikula
 */
trait Interaction[T, P, R, D, U <: BioObject]
extends Action[T, P, R]
{

	/**
	 * Performs the interaction with/between {@code participants}
	 * (which are delegates of {@code parent}'s children).
	 * @param parent bio-object that initiates interaction
	 * with/between its children.
	 * @param participants delegates of {@code parent}'s children
	 * participating in the interaction.
	 * @param notifyProgress callback for progress notifications.
	 * @return the result of the interaction.
	 */
	def perform(parent: T, participants: Iterable[WrappedDelegate[D, U]], notifyProgress: P=>Unit): R

}